import { get, put, post, deleteFun } from "./http.js";
import { decryptData } from '../utils/index.js'

export const getImgCode = (params) =>
  get("/admin-api/system/captcha/get-image", params); //获取图形验证码

export const passwordLogin = (params) =>
  post("/app-api/member/auth/code-login", params); //登录

export const createStudent = (params) =>
  post("/app-api/member/auth/createStudentUser", params); //注册

export const getStudentCurriculumVitaeBylogin = (params) =>
  get(
    "/app-api/student/student-curriculum-vitae/getStudentCurriculumVitaeBylogin",
    params
  ); //获取简历id

export const getCompanyList = (params) =>
  post("/app-api/student/company/page1", params); //获取企业列表
  export const getCompanyListOld = (params) =>
  post("/app-api/student/company/page", params); //获取企业列表

export const getHotCompanyList = (params) =>
  post("/app-api/student/company/getHotCompanyPage1", params); //获取热门企业列表

export const getCompanyInfo = (params) =>
  get("/app-api/student/company/get", params); //获取企业详情

export const getJobList = (params) =>
  post("/app-api/student/job/page1", params); //获取职位列表,最新职位集合，包含置顶、排序的组合
export const getJobListOld = (params) =>
  post("/app-api/student/job/page", params); //获取职位列表

export const getHotJobList = (params) =>
  get("/app-api/student/job/getHotJobList1", params); //获取热门职位列表

export const getJobInfo = (params) => get("/app-api/student/job/get", params); //获取职位详情

export const getUerInfo = (params) =>
  get("/app-api/student/web-student/getByMobile", params); //获取用户信息

export const upUserInfo = (params) =>
  put("/app-api/student/web-student/update", params); //更新用户信息

export const getRecord = (params) =>
  post("/app-api/student/curriculum-vitae-send-record/page", params); //获取投递记录

export const isSend = (params) =>
  get("/app-api/student/curriculum-vitae-send-record/isSend", params); //判断是否投递过

export const sendVitae = (params) =>
  post("/app-api/student/curriculum-vitae-send-record/send", params); //简历投递

export const getInviteList = (params) =>
  post("/app-api/student/invite/page", params); //获取面试邀约

export const getInviteInfo = (params) =>
  get("/app-api/student/invite/get", params); //获取面试邀约详情同面试反馈详情

export const updateInvite = (params) =>
  put("/app-api/student/invite/update", params); //更新邀约 同反馈详情页发起评论

export const getInvitedFeedback = (params) =>
  post("/app-api/student/invite/invitedFeedback", params); //获取面试反馈列表页

export const getStudentCurriculumVitae = (params) =>
  get("/app-api/student/student-curriculum-vitae/get", params); //获取简历信息

export const createStudentCurriculumVitae = (params) =>
  post("app-api/student/student-curriculum-vitae/create", params); //创建简历信息

export const updateStudentCurriculumVitae = (params) =>
  put("app-api/student/student-curriculum-vitae/update", params); //更新简历信息

export const getBanner = (params) =>
  get("/app-api/student/banner/page", params); //获取首页banner

export const getStudentShow = (params) =>
  get("/app-api/student/studentShow/page", params); //获取学生风采列表

export const getStudentShowInfo = (params) =>
  get("/app-api/student/studentShow/get", params); //获取学生风采详情

export const getSmsCode = (params) =>
  post("/app-api/member/auth/send-sms-code", params); //获取短信

export const smsLogin = (params) =>
  post("/app-api/member/auth/sms-login", params); //短信登录

export const isJob = (params) => get("/app-api/student/job/isJob", params); // 判断学生
export const getNums = (params) =>
  get("/app-api/student/invite/noOpenInvitationRecordCount", params); //获取未查看的邀约数量
export const getNums2 = (params) =>
  get("/app-api/student/invite/isOpenInvitationRecordCount", params); //获取未查看的反馈数量

export const sendStudentMsg = (params) =>
  post("/app-api/member/auth/send-sms-graphical-code", params); // 学生通过图形验证码，发送短信修改手机号
export const changeStudentPhone = (params) =>
  put("/app-api/student/web-student/changeStudentPhone", params); // 学生通过图形验证码，发送短信修改手机号

export const isRealName = (params) =>
  post("/app-api/public/user/isRealName", params); // 三要素认证

export const geStudentNewsStudyInfoPage = (params) =>
  get("/app-api/student/new-study-info/geStudentNewsStudyInfoPage", params); // 列表

export const getStudentNewsStudyInfoById = (params) =>
  get("/app-api/student/new-study-info/getStudentNewsStudyInfoById", params); // 新闻详情

// 获取新闻栏目
export const getStudentNewsStudyType = (params) => {
  return get("/app-api/student/new-study-info/getStudentNewsStudyType", params);
};

// 获取周榜 月榜
export const getStudentNewsStudyRanking = (params) => {
  return get(
    "/app-api/student/new-study-info/getStudentNewsStudyRanking",
    params
  );
};
// 职位浏览记录
export const getJobViewRecord = (params) => {
  return post("/app-api/student/job/getJobViewPage", params);
};

// 获取站内信分页列表
export const getInnerMsgList = (params) => {
  return post("/app-api/student/message/page", params);
};
// 获取站内信分页列表
export const getInnerMsgDetail = (params) => {
  return post("/app-api/student/message/get", params);
};
// 站内信留言回复
export const innerMsgReply = (params) => {
  return post("/app-api/student/message/replyMessage", params);
};
// 发起站内信留言
export const putInnerMsg = (params) => {
  return post("/app-api/student/message/sendMessage", params);
};
// /admin-api
export const getMsgType = (params) => {
  return post("/app-api/student/message/typeList", params);
};

// changeMessageStatus
export const changeMessageStatus = (params) => {
  return post("/app-api/student/message/changeMessageStatus", params);
};
// /app-api/student/message/allchangeMessageStatus
export const allchangeMessageStatus = (params) => {
  return post("/app-api/student/message/allchangeMessageStatus", params);
};
// 收藏职位列表
export const getCollectJob = (params) => {
  return post("/app-api/student/collect-job/page", params);
};
// 收藏企业列表
export const getCollectCompany = (params) => {
  return post("/app-api/student/collect-company/page", params);
};
// 收藏职位
export const createOrUpdateCollectJob = (params) => {
  return post("/app-api/student/collect-job/createOrUpdateCollectJob", params);
};
// 收藏企业
export const createOrUpdateCollectCompany = (params) => {
  return post(
    "/app-api/student/collect-company/createOrUpdateCollectCompany",
    params
  );
};
// 判断企业是否收藏
export const isCollectCompany = (params) => {
  return post("/app-api/student/collect-company/isCollect", params);
};
// 判断职位是否收藏
export const isCollectJob = (params) => {
  return post("/app-api/student/collect-job/isCollect", params);
};

export const getInnerMsgNum = () => {
  return post("/app-api/student/message/noOpenMessageCount");
};
// /student/praxis-project 项目管理类型
export const getPraxisProjectTypeList = () => {
return get("/app-api/student/praxis-project/getPraxisProjectTypeList");
}
//  项目列表
export const getPraxisProjectPage = (params) => {
return post("/app-api/student/praxis-project/page", params);
}
//  项目详情
export const getPraxisProjectItem = (params) => {
return get("app-api/student/praxis-project/get", params);
}
// 项目结果分页 
export const getProjectResultPage = (params) => {
return post("/app-api/student/praxis-project/getProjectResultPage", params);
}
//  项目结果详情
export const getProjectResultById = (params) => {
return get("/app-api/student/praxis-project/getProjectResultById", params);
}
// 个人、团队项目报名 
export const createProductEntry = (params) => {
return post("/app-api/student/entry/create", params);
}
// 项目管理- 判断学生是否入选
export const getStudentInfoByMobile = (params) => {
    return get("/app-api/student/student-curriculum-vitae/getStudentInfoByMobile", params);
}
// 项目管理-报名信息分页
export const getStudentEntryPage = (params) => {
    return post("/app-api/student/entry/page ", params);
}
//   上传报名材料
export const uploadAnnex = (params) =>
  put("/app-api/student/entry/uploadAnnex", params);

  // /app-api/student/entry/delete
  export const deleteAnnex = (params) =>
  deleteFun("/app-api/student/entry/delete", params);
  
// 获取学生报名信息
export const getStudentEntryInfo = (params) => {
    return get("/app-api/student/entry/get", params);
}

// 队长更新报名信息
export const updateStudentEntry = (params) =>
  put("/app-api/student/entry/update", params);

  // 项目管理-比赛管理 
  export const getSchedulePage = (params) => {
    return post("/app-api/student/entry/schedulePage", params);
} 
  // 项目管理-比赛管理 
  export const getMatchResultInfo = (params) => {
    return get("/app-api/student/entry/getResultInfo", params);
} 
//   实践反馈分页
export const getMatchFeedbackList = (params) => {
    return post("/app-api/student/feedback/page", params);
} 
//   更新项目实践
export const updateFeedback = (params) =>
  put("/app-api/student/feedback/update", params);
 //   get 传项目id，判断用户是否在遴选阶段入选
 export const getCheckStatus = (params) => {
    return get("/app-api/student/entry/getCheckStatus", params);
} 
//   根据项目id获取相关公示
export const getResultInfoByProjectId = (params) => {
    return get("/app-api/student/entry/getResultInfoByProjectId", params);
}
//  获取阿里云OSS
export const getOssInfo = () => {
    return new Promise(async(resolve, reject) => {
        const res = await get("/app-api/student/web-student/getOssInfo", {});
        if (res && res.data && typeof res.data === 'string') {
            resolve(decryptData(res.data))
        } else {
            resolve(res)
        }
    })
}
// AI简历模块签名接口
export const getOccupationGenerateSignature = (params) => {
    return post("/app-api/student/web-student/getOccupationGenerateSignature", params);
} 